home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
comm
/
irc
/
KuangEleven3Gm.lha
/
Kuang Eleven 3
/
Rexx
/
ksmaster.amirx
< prev
next >
Wrap
Text File
|
1998-05-19
|
7KB
|
217 lines
/* $VER: KSMaster.amirx 1.8 (18.5.98) Kick & Say Master Script */
/* */
/* Read the KSMaster.guide or look on my home page for more info */
/* */
/* IRC Bossman^ Email: bosman@erols.com www.erols.com/bosman */
/*-----------------------------------------------------------------------*/
OPTIONS RESULTS
SIGNAL ON SYNTAX
cr='0a'x
libs = "rexxsupport.library rexxdossupport.library rexxkuang11.library"
DO UNTIL libs=''
PARSE VAR libs lib libs
IF EXISTS('libs:'lib)|EXISTS('Libs/'lib)|EXISTS(lib) THEN DO
IF ~show('L',lib) THEN call addlib(lib,0,-30,0)
END
ELSE DO
LECHO('Cannot load 'lib)
EXIT
END
END
PARSE ARG cmd chan nick type rand .
cmd = STRIP(cmd);chan = STRIP(chan)
nick = (nick);type = (type);rand = (rand)
"GETMYNICK";mynick=RESULT
IF LEFT(chan,1) ~= '#' THEN DO
"GETCHANNEL";channel=result
rand = type
type = nick
nick = chan
END
ELSE channel = chan
UPPER cmd
IF cmd = "SAY" | cmd = "TSAY" THEN rand = type
"GETPROGDIR";Amircpath = result
IF cmd = 'KICK' | cmd = 'TKICK' THEN datadir = ADDPART(Amircpath,'kuang11/KSkicks')
IF cmd='SAY'|cmd='PSAY'|cmd='TSAY' THEN datadir = ADDPART(Amircpath,'kuang11/KSSay')
IF cmd='PGREET'|cmd='GREET'|cmd='TGREET' THEN datadir = ADDPART(Amircpath,'kuang11/KSGreets')
totaldata = 0
IF nick = "?" THEN DO
IF cmd = 'KICK' | cmd = 'TKICK' THEN ksdata = 'Kicks'
IF cmd='SAY'|cmd='PSAY'|cmd='TSAY' THEN ksdata = 'Sayings'
IF cmd = 'GREET' | cmd = 'TGREET' THEN ksdata = 'Greetings'
CECHO('Here is a list of Currently installed 'ksdata'.')
FILES=SHOWDIR(datadir,'FILE',cr)
IF FILES~='' THEN DO UNTIL FILES=''
PARSE VAR FILES file (cr) FILES
IF UPPER(RIGHT(file,4))~='.KSM' THEN iterate
filename=addpart(datadir,file)
OPEN(1,addpart(datadir,file),'R')
line=readln(1)
CLOSE(1)
PARSE VAR line '$VER:' name'.ksm' version date description '*/'
numberdata = fcountstrlines(filename,'#?#')
totaldata = numberdata + totaldata
CECHO(BOLD(LEFT(name,10)) LEFT(version,5) strip(description) '('numberdata')')
END
CECHO('You have 'bold(totaldata ksdata)' to choose from.')
EXIT
END
IF UPPER(nick)='%U' THEN DO
"GETSELECTEDUSER";nick=result
END
IF (cmd = "KICK" | cmd = "TKICK") & nick = "" THEN DO
CECHO('Usage: /Kicker [NICK | %U] [* | <type>] <NUM>')
CECHO('/Kicker ? - Returns list of installed kickfiles.')
CECHO('/Kicker [NICK] * - Selects random kickfile.')
CECHO('/Kicker %U * - Uses Selected nick.')
EXIT
END
IF (cmd="SAY"|cmd="TSAY"|cmd="PSAY")&nick = "" THEN DO
CECHO('Usage: /Say [*|<type>] <NUM>')
CECHO('/Say ? - Returns list of installed sayfiles')
CECHO('/Say * - Selects random sayfile.')
CECHO('Usage: /PSay [NICK | %U] [*|<type>] <NUM>')
EXIT
END
IF (cmd="TGREET"|cmd="GREET"|cmd="PGREET")&nick = "" THEN DO
CECHO('Usage: /GREET [NICK | %U] [*|<type>] <NUM>')
CECHO('/GREET ? - Returns list of installed GREET files')
CECHO('/GREET [NICK | %U] * - Selects random GREETfile.')
CECHO('/PGREET [NICK | %U] [*|<type>] <NUM>')
EXIT
END
IF cmd="KICK"|cmd="TKICK"|cmd="PSAY"|cmd="PGREET"|cmd="GREET" THEN DO
IF ~ISON(nick) THEN DO
CECHO(nick 'is not presently in a Channel You are in.')
EXIT
END
"GETUSERS"
users = STRIP(TRANSLATE(result, " ", "@+"),"L")
nick=word(right(users,length(users)-POS(UPPER(nick),UPPER(users))+2),1)
"userhost" nick;kicknickhost = result
PARSE VAR kicknickhost username'@'hosty .
END
IF cmd = 'SAY' | cmd = 'TSAY' THEN type = nick
IF nick = "*" | type = "*" THEN DO
FILES=SHOWDIR(datadir,'FILE',cr)
stemvar.=''
IF FILES~='' THEN DO I=1 UNTIL FILES=''
PARSE VAR FILES file (cr) FILES
IF UPPER(RIGHT(file,4))~='.KSM' THEN DO
I=I-1
iterate
END
stemvar.i=file
END
stemvar.0=I
rand=RANDOM(1,stemvar.0,RANDOM(1,RANDOM(1,999),time('S')))
dataline=stemvar.rand
PARSE VAR dataline type '.' blah
END
ksdatafile = ADDPART(datadir,type'.ksm')
IF ~EXISTS(ksdatafile) THEN DO
CECHO('You do not have 'UPPER(bold(type))' data file installed')
EXIT
END
datacount = FCOUNTSTRLINES(ksdatafile,'#?#')
SELECT
WHEN rand="" THEN rand=RANDOM(1,datacount,RANDOM(1,RANDOM(1,999),time('S')))
WHEN ~DATATYPE(rand,'W') THEN DO
oldrand=rand
rand=RANDOM(1,datacount,RANDOM(1,RANDOM(1,999),time('S')))
CECHO('Entered argument 'bold(oldrand)' must be a number. Using' rand)
END
WHEN rand>datacount THEN DO
oldrand=rand
rand=RANDOM(1,datacount,RANDOM(1,RANDOM(1,999),time('S')))
CECHO('Selected argument 'bold(oldrand)' is too big. Using' rand)
END
OTHERWISE NOP
END
cecho("Using datafile" bld(type) "entry number" rand)
kickline = FGETLINES(ksdatafile,'#?#',rand)
banline = '/ban 'channel '*!*'username'@'||getdomain(hosty)
kickdataline = '/kick 'channel nick
Kickline = STRREPLACE("$me,\mynick,$$1,\[kicknick],$chan,\channel,\bld,\und,\inv,\bannick,\kick" , mynick','mynick','nick','nick','channel','channel||','||'02'x||','||'1F'x||','||'16'x||','banline','kickdataline,kickline)
DO Y=1 UNTIL kickline=''
PARSE VAR kickline line.y 'a'x kickline
END
IF cmd='PGREET'|cmd='GREET'|cmd='TGREET' THEN dly = 20
IF cmd='PSAY'|cmd='SAY'|cmd='TSAY' THEN dly = 250
IF cmd = 'KICK' | cmd = 'TKICK' THEN dly = 75
subdly = dly
SELECT
WHEN (cmd = 'KICK' | cmd = 'SAY' | cmd = 'GREET') THEN DO
DO lines = 1 to y
'say ""'line.lines
IF UPPER(word(line.lines,1)) = '/NICK' THEN dly = 275
ELSE dly = subdly
CALL DELAY(dly)
END
END
WHEN (cmd = 'PSAY' | cmd = 'PGREET') THEN DO
DO lines = 1 to y
tly=0
IF line.lines = "" THEN iterate
IF UPPER(word(line.lines,1))='/ME' THEN DO
line.lines=DELWORD(line.lines,1,1)
dline=mynick' 'line.lines
line.lines=d2c(1)'ACTION 'Line.lines||d2c(1)
tly = 1
END
IF cmd='PSAY' & tly = 0 THEN PECHO('>'nick'<',line.lines)
IF cmd='PSAY' & tly = 1 THEN PECHO('*',dline)
IF cmd='PGREET' & tly = 1 THEN PECHO('*',dline)
IF cmd='PGREET' & tly = 0 THEN PECHO('>'nick'<',line.lines)
PMSG(Nick,line.lines)
CALL DELAY(dly)
END
END
OTHERWISE DO lines = 1 to y
CECHO(line.lines)
END
END
EXIT
GETUSR:;"GETUSERS";return result
ISON:;IF pos(UPPER(arg(1))' ',UPPER(getusr())' ')~==0 THEN return 1;ELSE return 0
PECHO:;"ECHO P="d2c(27)"b"arg(1)" C=2" arg(2);return 0
PMSG:;'QueueRAW PRIVMSG' ARG(1) ':'ARG(2);RETURN 0
CECHO:;"ECHO P="d2c(27)"b«"KSMaster"» C=6" arg(1);return 0
LECHO:;"ECHO P="d2c(27)"b«"Error"» C=6" arg(1);return 0
BOLD:;return '02'x||arg(1)||'02'x
SYNTAX:;cecho("Command on line" SIGL "returned" RC ":" errortext(rc) sourceline(SIGL));EXIT